package com.kgc.xsProvider.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.xs.remote.SalesOrderSummaryRemote;
import com.kgc.xsProvider.service.SalesOrderSummaryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class SalesOrderSummaryController implements SalesOrderSummaryRemote {

    private Logger logger = LoggerFactory.getLogger(SalesOrderSummaryController.class);

    @Autowired
    private SalesOrderSummaryService salesOrderSummaryService;

    @Override
    public ResponseMsg selectSummaryByCustomer(Map<String, Object> map) {
        logger.info("SalesOrderSummaryController selectSummaryByCustomer map:{}", map);
        ResponseMsg msg = salesOrderSummaryService.selectSummaryByCustomer(map);
        logger.debug("SalesOrderSummaryController selectSummaryByCustomer msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectSummaryByMonthTime(Map<String, Object> map) {
        logger.info("SalesOrderSummaryController selectSummaryByMonthTime map:{}", map);
        ResponseMsg msg = salesOrderSummaryService.selectSummaryByMonthTime(map);
        logger.debug("SalesOrderSummaryController selectSummaryByMonthTime msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectSummaryByYearTime(Map<String, Object> map) {
        logger.info("SalesOrderSummaryController selectSummaryByYearTime map:{}", map);
        ResponseMsg msg = salesOrderSummaryService.selectSummaryByYearTime(map);
        logger.debug("SalesOrderSummaryController selectSummaryByYearTime msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg getTotalSalesDataByDate() {
        logger.info("SalesOrderSummaryController getTotalSalesDataByDate is start...");
        ResponseMsg msg = salesOrderSummaryService.getTotalSalesDataByDate();
        logger.debug("SalesOrderSummaryController getTotalSalesDataByDate msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg getSalesOutBoundDataByTime() {
        logger.info("SalesOrderSummaryController getSalesOutBoundDataByTime is start...");
        ResponseMsg msg = salesOrderSummaryService.getSalesOutBoundDataByTime();
        logger.debug("SalesOrderSummaryController getSalesOutBoundDataByTime msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg getReceivableDataByTime() {
        logger.info("SalesOrderSummaryController getReceivableDataByTime is start...");
        ResponseMsg msg = salesOrderSummaryService.getReceivableDataByTime();
        logger.debug("SalesOrderSummaryController getReceivableDataByTime msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg getSalesReturnDataByTime() {
        logger.info("SalesOrderSummaryController getSalesReturnDataByTime is start...");
        ResponseMsg msg = salesOrderSummaryService.getSalesReturnDataByTime();
        logger.debug("SalesOrderSummaryController getSalesReturnDataByTime msg:{}",msg);
        return msg;
    }
}
